<%@page import="java.util.ArrayList"%>
<%@page import="bean.FmBoardVo"%>
<%@page import="bean.FmBoardDTO"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel = 'stylesheet' href='./FmBoard/Board.css'/>
<script src='./FmBoard/Board.js'></script>
</head>
<body>

<jsp:useBean id="vo" class="bean.FmBoardVo" scope="page"></jsp:useBean>
<jsp:setProperty property="*" name="vo"/>


<%
FmBoardDTO dto = new FmBoardDTO();
dto.setVo(vo);
ArrayList<FmBoardVo> subal = dto.sublist();
dto.cntHits();
FmBoardVo v = dto.selectOne();
String m = "";
if(session.getAttribute("sessionMid")!= null){
	m = (String)session.getAttribute("sessionMid");
}
int de = v.getDeep().split("-").length;


%>
글번호:
<%=v.getRno() %>
<h1><%=v.getSubject() %></h1>


<%if(de==1){ %>
<div id='vPic'><%if(v.getPic()!=null){ %><img src='./BoardPhoto/sm_<%=v.getPic() %>' align="middle" alt ='사진' width='100px' height='100px' style="cursor:pointer" onclick="newPic('./BoardPhoto/<%=v.getPic()%>')">
	<%}else{ %><img src='./FmBoard/noImg.png' align="middle" alt ='사진' width='100px' height='100px'><%} %></div>
<div id='vMid'>작성자 : <%=v.getMid() %> </div>
<div id='vWdate'>작성일자 : <%if(v.getWdate()!=null){%><%=v.getWdate().substring(0,10)%><%} %></div>
<div id='vLocate'>보호지역 : <%if(v.getLocate()!=null){%><%=v.getLocate() %><%} %></div>
<div id='vPhone'>연락처 : <%if(v.getPhone()!=null){%><%=v.getPhone() %><%} %></div>
<div id='vKind'>품종 : <%if(v.getKind()!=null){%><%=v.getKind() %><%} %></div>
<div id='vGender'>성별 : <%if(v.getGender()!=null){%><%=v.getGender()%><%} %></div>
<div id='vAge'>나이 : <%if(v.getAge()!=null){%><%=v.getAge()%> 살 <%} %></div>
<div id='vMoney'>책임비 : <%=v.getMoney() %> 원</div>
<div id='vContent'><pre><%=v.getContent() %></pre></div>
<%}else{ %>
<div id='vMid'>작성자 : <%=v.getMid() %> </div>
<div id='vWdate'>작성일자 : <%if(v.getWdate()!=null){%><%=v.getWdate().substring(0,10)%><%} %></div>
<div id='vContent'><pre><%=v.getContent() %></pre></div>
<%} %>


<%-- <table align='center' border = '1'>
<tr>
	<td rowspan=4><%if(v.getPic()!=null){ %><img src='./BoardPhoto/sm_<%=v.getPic() %>' align="middle" alt ='사진' width='100px' height='100px'>
	<%}else{ %><img src='./FmBoard/noImg.png' align="middle" alt ='사진' width='100px' height='100px'><%} %></td>
	<td bgcolor='#99ccff'>작성자</td>
	<td><%=v.getMid() %></td>
	<td bgcolor='#99ccff'>등록일자</td>
	<td><%if(v.getWdate()!=null){%><%=v.getWdate().substring(0,10)%><%} %></td></tr>
<tr>
	<td bgcolor='#99ccff'>보호지역</td>
	<td><%if(v.getLocate()!=null){%><%=v.getLocate() %><%} %></td>
	<td bgcolor='#99ccff'>연락처</td>
	<td><%if(v.getPhone()!=null){%><%=v.getPhone() %><%} %></td></tr>
<tr>
	<td bgcolor='#99ccff'>품종</td>
	<td><%if(v.getKind()!=null){%><%=v.getKind() %><%} %></td>
	<td bgcolor='#99ccff'>성별</td>
	<td><%if(v.getGender()!=null){%><%=v.getGender()%><%} %></td></tr>
<tr>
	<td bgcolor='#99ccff'>나이</td>
	<td><%if(v.getAge()!=null){%><%=v.getAge()%> 살 <%} %> </td>
	<td bgcolor='#99ccff'>책임비</td>
	<td><%=v.getMoney() %> 원</td></tr>	
<tr>
	<td colspan=5><div id='con'><pre><%=v.getContent() %></pre></div></td></tr>
</table> --%>
<p/><p/><p/>
<input type='button' value='게시글 목록' id='btnList'/>
<%if(m.equals(v.getMid())){ %>
<input type='button' value='게시글 수정' id='btnModify' />
<input type='button' value='게시글 삭제' id='btnDelete'/>
<%}else if(!m.equals("")){ %>
<input type='button' value='답글 달기' id='btnRep'/>
<%} %>
<%System.out.println("뷰에서 딥은 : "+ v.getDeep()); %>
<%System.out.println("뷰에서 사진은 : "+ v.getPic()); %>



<br>
<%
for(int a = 0; a<subal.size(); a++){
FmBoardVo vv = subal.get(a);%>
	

<div class='board_view_items'>
	<div class='board_view_rno'><%=vv.getRno() %></div>
	<div class='board_view_kind'><%if(vv.getKind()!=null){%><%=vv.getKind() %><%} %></div>
	<div class='board_view_subject'>
		<a href='#' onclick='goView(<%=dto.getNowPage()%>,<%=vv.getRno()%>)'>
		<%
		int d = vv.getDeep().split("-").length;
		if(d > 1){
			for(int aa = 0; aa <d; aa++){
				out.print("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
			}
			out.print("┖");
		}
		if(v.getRno()==vv.getRno()){out.print("<font size=4><b>");
		%>
		
		<%=vv.getSubject() %> <%out.print("</b></font>");} else{out.print(vv.getSubject());}%>
		</a></div>
	<div class='board_view_locate'><%if(vv.getLocate()!=null){%><%=vv.getLocate() %><%} %></div>
	<div class='board_view_wdate'><%if(vv.getWdate()!=null){%><%=vv.getWdate().substring(0,10)%><%} %></div>
</div>
	
	<%
}

%>
<form name='hiddenFrm' method='post' >
	<input type='hidden' name='nowPage' value='<%=vo.getNowPage() %>'/>
	<input type='hidden' name='kindFind' value='<%=vo.getKindFind()%>'/>
	<input type='hidden' name='locateFind' value='<%=vo.getLocateFind()%>'/>
	<input type='hidden' name='genderFind' value='<%=vo.getGenderFind()%>'/>
	<input type='hidden' name='find' value='<%=vo.getFind()%>'/>
	<input type='hidden' name='rno' value='<%=v.getRno()%>'/>
	<input type='hidden' name='pic' value='<%=v.getPic() %>' />
	<input type='hidden' name='mid' value='<%=m %>'/>
	<input type='hidden' name='subject' value='<%=v.getSubject() %>'/>
	<input type='hidden' name='deep' value='<%=v.getDeep() %>'/>
	
</form>


<script>bViewInit();</script>
</body>
</html>